package com.qlylkj.lbk.ui.photo

import android.net.Uri
import com.bumptech.glide.request.RequestOptions
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.forest.core.etx.load
import com.forest.core.etx.screenHeight
import com.forest.core.etx.screenWidth
import com.github.chrisbanes.photoview.PhotoView
import com.qlylkj.lbk.R

class PhotoPagerAdapter(var dismiss: () -> Unit = {},data: MutableList<Any>) :
    BaseQuickAdapter<Any, BaseViewHolder>(R.layout.item_dialog_photo_pager, data) {

    override fun convert(helper: BaseViewHolder, item: Any?) {
        helper.apply {
            item?.let {
                val photoView = getView<PhotoView>(R.id.photoView)
                photoView.apply {
                    when(it){
                        is String -> {
                            photoView.load(mContext,it)
                        }
                        is Int -> {
                            photoView.setImageResource(it)
                        }
                    }
                    setOnClickListener {
                        dismiss()
                    }
                }
            }
        }

    }
}